﻿<!DOCTYPE html>

<html>
<head>
	<meta name="viewport" content="width=device-width" />
	<title>@ViewBag.Title</title>	
	<link href="~/Contents/StyleLayout.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div id="Wrapper">
		<div class="Header">
			<div id="Logo"><a href="@Url.Action("Index", "Home")"><img src="~/Images/logo.gif" /></a></div>
			<div id="User-Info">
				@{
					string TenDangNhap = "";
					if (Session["User"] == null && Request.Cookies["Login"] == null)
					{ 
						@Html.ActionLink("Đăng ký", "Dang_Ky", "Tai_Khoan")@Html.Raw("/")@Html.ActionLink("Đăng nhập", "Dang_Nhap", "Tai_Khoan")
					}
					else 
					{
						if (Session["User"] != null)
						{
							TenDangNhap = Session["User"].ToString();                           
						}
						else 
						{
							TenDangNhap = Request.Cookies["Login"].Values["User"];
							Session["User"] = TenDangNhap;
						}
						SnongPhoneShop.Models.SnongPhoneShopEntities db = new SnongPhoneShop.Models.SnongPhoneShopEntities();
						string HoTen = db.KhachHangs.First(m => m.TenDangNhap.Equals(TenDangNhap)).HoTen;
						@Html.Raw("Xin chào ") @Html.ActionLink(HoTen, "Index", "Tai_Khoan") @Html.Raw(", ") @Html.ActionLink("Đăng xuất", "Dang_Xuat", "Tai_Khoan")<br />                        
						int SumGH = 0;
						try
						{
							SumGH = (from GH in db.CT_GioHang where GH.TenDangNhapKH == TenDangNhap select GH).Sum(m => m.SoLuong);
						}
						catch { }
						@Html.ActionLink("Giỏ hàng ", "CT_GioHang", "Gio_Hang") @Html.Raw("đang có <i style=\"color:red\">" + SumGH + "</i> sản phẩm");
					}                    
				}
			</div>            
		</div>
		<div class="Menu-Bar">
			<ul id="Menu">
				<li><a href="@Url.Action("Index", "Home")"><span>Trang chủ</span></a></li>
				<li><a href="@Url.Action("Dien_Thoai", "San_Pham")"><span>Điện thoại</span></a></li>
				<li id="PK-Catalog">
					<a href="@Url.Action("Phu_Kien", "San_Pham")"><span>Phụ kiện</span></a>
					<ul>
						@using(SnongPhoneShop.Models.SnongPhoneShopEntities db = new SnongPhoneShop.Models.SnongPhoneShopEntities()){
							foreach (var Item in db.DanhMucSanPhams.Where(m => m.Publish == true && m.MaLoaiDanhMuc == 2).OrderBy(m => m.STT).ToList()) { 
								<li><a href="@Url.Action("DM_SanPham", "San_Pham", new { ID = Item.MaDanhMuc })"><span>@Item.TenDanhMuc</span></a></li>
							}
						}
					</ul>
				</li>
				<li><a href="@Url.Action("Bao_Gia_DT", "San_Pham")"><span>Báo giá</span></a></li>
				<li><a href="@Url.Action("Gioi_Thieu", "Home")"><span>Giới thiệu</span></a></li>
				<li><a href="@Url.Action("Lien_He", "Home")"><span>Liên hệ</span></a></li>
			</ul>
			<div id="div-search">
				@using (Html.BeginForm("Index", "Tim_Kiem", new { Mode = 1 }, FormMethod.Post))
				{ 
				<div>@Html.TextBox("Search1") <input type="submit" value="" name="Btt_Tim_Kiem" id="Btt_Tim_Kiem" /></div>
				}               
			</div>
		</div>
		<div class="Left-Content">
			<div class="Manufacturer">
				<span class="Title-Manu">Hãng điện thoại</span>
				<ul>
					@using(SnongPhoneShop.Models.SnongPhoneShopEntities db = new SnongPhoneShop.Models.SnongPhoneShopEntities()){
						foreach (var Item in db.DanhMucSanPhams.Where(m => m.Publish == true && m.MaLoaiDanhMuc == 1).OrderBy(m => m.STT).ToList()) { 
							<li><a href="@Url.Action("DM_SanPham", "San_Pham", new { ID = Item.MaDanhMuc })"><span>@Item.TenDanhMuc</span></a></li>
						}
					}
				</ul>
			</div>
		</div>		
		<div>
			@RenderBody()
		</div>
		<div class="Footer">
			<div class="Title-Footer">Bài tập môn lập trình Web</div>
			<div class="Left-Footer">
				Sinh viên thực hiện: 
					<ul style="list-style:circle">
						<li><a href="https://www.facebook.com/namikaze.minato.0712" target="_blank">Phạm Trung Hiếu</a></li>
						<li><a href="https://www.facebook.com/kemcoi.kemcoi" target="_blank">Phạm Xuân Đạt</a></li>
					</ul>
				Giáo viên hướng dẫn: <b>Đỗ Thanh Thủy</b><br /><br />
			</div>
			<div class="Right-Footer">
				<br /><br /><br /><br />
				Giao diện tham khảo: <a href="http://hoanghamobile.com">hoanghamobile.com</a>
			</div>
		</div>
	</div>    
</body>
</html>
